package com.tanhua.server.controller;



import com.tanhua.server.service.TaoHuaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

/**
 * @Author ${南五磊}
 * @Date 2022/1/14 14:18
 */
@RestController
@RequestMapping("/peachblossom")
public class PeachblossomController {

    @Autowired
    private TaoHuaService taoHuaService;


    /**
     * 桃花传音 --发送语音
     */
    @RequestMapping(method = RequestMethod.POST)
    public ResponseEntity sendVoice(MultipartFile soundFile) throws IOException {
        taoHuaService.sendVoice(soundFile);
        return ResponseEntity.ok(null);
    }

    /**
     * 桃花传音（接受）
     */
    @GetMapping
    public ResponseEntity receiveVoice() throws Exception {
        return taoHuaService.receiveVoice();
    }
}
